<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="t" uri="/thunms"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<t:head />
<body class="easyui-layout">
	<div region="center" border="false" style="padding: 5px;">
		<form id="qrtzJobsTimerForm" method="post">
			<fieldset>
				<legend>任务基本信息</legend>
				<table>
				<tr>
					<td width="10%">任务名称：</td>
					<td colspan="7" width="90%" ><input type="text" id="jobName" name="jobName"	class="easyui-validatebox" required="true" style="width: 100%" /></td>
				</tr>
				<tr>
					<td width="10%">分组名称：</td>
					<td width="20%"><input type="text" id="jobGroup" name="jobGroup"	class="easyui-validatebox" required="true" style="width: 100%"/></td>
					<td width="10%">业务主键：</td>
					<td width="20%"><input type="text" id="qrtzJobKey" name="qrtzJobKey" style="width: 100%" /></td>
					<td width="10%">开始时间：</td>
					<td width="15%"><input type="text" id="qrtzstartTime" name="qrtzstartTime" 	class="easyui-datetimebox" width="98%" /></td>
					<td width="10%">结束时间：</td>
					<td width="15%"><input type="text" id="qrtzendTime" name="qrtzendTime" 	class="easyui-datetimebox" width="98%"   /></td>
				</tr>
				
				<tr>
					<td colspan="8" align="center" width="100%">
					<input type="radio" id="qrtzType" name="qrtzType" onclick="qrtzTypeClick();"  value="1">计次调度配置
					<input type="radio" id="qrtzType" name="qrtzType" onclick="qrtzTypeClick();"  value="2">周期调度配置
					<input type="radio" id="qrtzType" name="qrtzType" onclick="qrtzTypeClick();" checked="checked"  value="3">定时调度配置
					</td>
				</tr>
				
			</table>
			</fieldset>
			
			<fieldset id="qrtzType1" style="display: none;" >
				<legend>计次调度配置</legend>
				<table class="tableForm">
					<tr>
						<td width="10%">执行次数：</td>
						<td colspan="3" width="40%" ><input type="text" name="repeatCount" width="98%"
							class="easyui-numberbox" value="1" /></td>
					
						<td width="10%">执行间隔：</td>
						<td colspan="3" width="40%" ><input type="text" name="repeatInterval" width="98%"
							class="easyui-numberbox" value="0" /></td>
					</tr>
				</table>
			</fieldset>
			<fieldset id="qrtzType2" style="display: none;" >
				<legend>周期调度配置</legend>
				<table class="tableForm">
				<tr>
					<td nowrap width="15%">每次执行间隔</td>
					<td nowrap colspan="6" width="78%"><input type="text" class="easyui-numberbox" value="60"  data-options="min:0,max:60,required:true" name="val" size="8">
					</td>
					<td nowrap width="5%"><select name="selType">
							<option value="second">秒</option>
							<option value="minute">分</option>
							<option value="hour">时</option>
					</select>
					</td>
				</tr>
				</table>
			</fieldset>
			<fieldset id="qrtzType3">
				<legend>定时调度配置</legend>
				<fieldset >
					<legend>指定星期配置</legend>
					<table>
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="1">周一
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="2">周二
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="3">周三
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="4">周四
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="5">周五
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="6">周六
							<input type="checkbox" class="weekList" onclick="qrtzCheckboxClick();" value="7">周日
					</table>
				</fieldset>
				<fieldset>
					<legend>指定月份配置</legend>
					<table>
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="1">1
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="2">2
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="3">3
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="4">4
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="5">5
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="6">6
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="7">7
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="8">8
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="9">9
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="10">10
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="11">11
							<input type="checkbox" class="mouthList" onclick="qrtzCheckboxClick();" value="12">12
					</table>
				</fieldset>
				<fieldset>
					<legend>指定日期配置</legend>
					<table>
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="1">1
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="2">2
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="3">3
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="4">4
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="5">5
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="6">6
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="7">7
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="8">8
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="9">9
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="10">10
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="11">11
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="12">12
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="13">13
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="14">14
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="15">15
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="16">16
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="17">17
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="18">18
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="19">19
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="20">20
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="21">21
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="22">22
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="23">23
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="24">24
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="25">25
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="26">26
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="27">27
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="28">28
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="29">29
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="30">30
							<input type="checkbox" class="dayList" onclick="qrtzCheckboxClick();" value="31">31
					</table>
				</fieldset>
				<fieldset>
					<legend>指定小时配置</legend>
					<table>
					
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="0">00
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="1">01
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="2">02
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="3">03
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="4">04
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="5">05
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="6">06
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="7">07
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="8">08
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="9">09
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="10">10
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="11">11
						
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="12">12
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="13">13
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="14">14
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="15">15
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="16">16
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="17">17
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="18">18
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="19">19
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="20">20
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="21">21
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="22">22
							<input type="checkbox" class="hourList" onclick="qrtzCheckboxClick();" value="23">23
						
					</table>
				</fieldset>
				<fieldset>
					<legend>指定分钟配置</legend>
					<table>
					
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="0">00
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="1">01
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="2">02
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="3">03
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="4">04
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="5">05
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="6">06
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="7">07
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="8">08
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="9">09
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="10">10
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="11">11
						
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="12">12
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="13">13
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="14">14
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="15">15
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="16">16
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="17">17
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="18">18
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="19">19
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="20">20
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="21">21
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="22">22
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="23">23
							
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="24">24
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="25">25
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="26">26
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="27">27
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="28">28
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="29">29
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="30">30
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="31">31
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="32">32
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="33">33
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="34">34
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="35">35
						
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="36">36
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="37">37
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="38">38
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="39">39
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="40">40
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="41">41
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="42">42
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="43">43
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="44">44
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="45">45
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="46">46
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="47">47
							
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="48">48
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="49">49
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="50">50
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="51">51
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="52">52
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="53">53
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="54">54
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="55">55
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="56">56
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="57">57
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="58">58
							<input type="checkbox" class="secondList" onclick="qrtzCheckboxClick();" value="59">59
						
						
					</table>
				</fieldset>
				<fieldset>
					<legend>Cron表达式</legend>
					<table>
					<div id="qrtzmsg">
					</div>
					<input type="text" name="cronExpression" style="width:100%;" value="0 0 * * * ? " id="cronExpression" readonly="readonly"/>
					</table>
				</fieldset>
			</fieldset>
			
		</form>
	</div>
	<script type="text/javascript">
		//切换配置类型
	 function qrtzTypeClick(){
		 var c=$("#qrtzType:checked").val();
		 if(c=='1'){
			 $("#qrtzType1").show();
			 $("#qrtzType2").hide();
			 $("#qrtzType3").hide();
		 }else if(c=='2'){
			 $("#qrtzType1").hide();
			 $("#qrtzType2").show();
			 $("#qrtzType3").hide();
		 }else if(c=='3'){
			 $("#qrtzType1").hide();
			 $("#qrtzType2").hide();
			 $("#qrtzType3").show();
		 }
	 }
		//规则配置
		function qrtzCheckboxClick(){
			var weekList=$(".weekList:checked");
			
			
			var msg="";
			var cron="";
			if(weekList.size()>0){
				$(".dayList").removeAttr("checked").attr("disabled","disabled");
				var temp="";
				msg="每周"
				weekList.each(function(i){
						if(i>0){
							temp=temp+",";
							msg=msg+"、";
						}
					  var v= $(this).val();
					  if(v=='1'){
						  msg=msg+"周一"; 
					  }else if(v=='2'){
						  msg=msg+"周二"; 
					  }else if(v=='3'){
						  msg=msg+"周三";  
					  }else if(v=='4'){
						  msg=msg+"周四"; 
					  }else if(v=='5'){
						  msg=msg+"周五";  
					  }else if(v=='6'){
						  msg=msg+"周六";  
					  }else if(v=='7'){
						  msg=msg+"周日"; 
					  }
					  
					  temp=temp+v;
				 });
				cron=temp+" "+cron;
			}else{
				$(".dayList").removeAttr("disabled");
				
				cron="? "+cron;	
				
			}
			var mouthList=$(".mouthList:checked");
			var dayList=$(".dayList:checked");
			var hourList=$(".hourList:checked");
			
			if(mouthList.size()>0){
				var temp="";
				msg=msg+";每年";
				mouthList.each(function(i){
						if(i>0){
							temp=temp+",";
							msg=msg+"、";
						}
						var v=$(this).val();
						msg=msg+v+"月";
					  temp=temp+v;
				 });
				cron=temp+" "+cron;
			}else{
				cron="* "+cron;	
			}
			if(dayList.size()>0){
				var temp="";
				msg=msg+";每月";
				dayList.each(function(i){
						if(i>0){
							temp=temp+",";
							msg=msg+"、";
						}
						var v=$(this).val();
						msg=msg+v+"号";
					  temp=temp+v;
				 });
				cron=temp+" "+cron;
			}else{
				if(weekList.size()>0){
					cron="? "+cron;
				}else{
					cron="* "+cron;
				}
					
			}
			if(hourList.size()>0){
				var temp="";
				msg=msg+";每天";
				hourList.each(function(i){
						if(i>0){
							temp=temp+",";
							msg=msg+"、";
						}
						var v=$(this).val();
						msg=msg+v+"点";
					  temp=temp+v;
				 });
				cron=temp+" "+cron;
			}else{
				cron="* "+cron;	
			}
			
			var secondList=$(".secondList:checked");
			if(secondList.size()>0){
				var temp="";
				msg=msg+";每小时";
				secondList.each(function(i){
						if(i>0){
							temp=temp+",";
							msg=msg+"、";
						}
						var v=$(this).val();
						msg=msg+v+"分";
					  temp=temp+v;
				 });
				cron=temp+" "+cron;
			}else{
				cron="0 "+cron;	
			}
			
			cron="0 "+cron;
			$("#qrtzmsg").empty().append(msg+"，进行任务调度。");
			$("#cronExpression").val(cron);
		}
		
	</script>
</body>
</html>
